
package com.csc440.team2.activity;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import com.csc440.team2.smil.SMILImageComponent;


public class AddImage extends Activity
{
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.position_layout);
    }


    public void returnToParent(View clickedView)
    {
        Intent data = new Intent();
        SMILImageComponent comp = SMILImageComponent.create();
        comp.setDuration(Integer.parseInt(((EditText) this.findViewById(R.id.EditText02)).getText().toString()));
        comp.setSrc(((EditText) this.findViewById(R.id.EditText01)).getText().toString());
        data.putExtra("test", comp);
        setResult(3, data);
        finish();
    }
    public void browseFiles(View clickedView)
    {
	Intent in = new Intent(AddImage.this, FileBrowser.class);
    	AddImage.this.startActivityForResult(in, 3);
    }
    protected void onActivityResult(int requestCode, int resultCode, Intent data)
    {
	EditText source = (EditText)this.findViewById(R.id.EditText01);
	source.setText((data.getExtras().get("test")).toString());
    }
}
